package org.jeecg.enums.base;

/**
 * 机构属性
 */
public enum DepartPropertyEnum {
    DEPART_PROPERTY_CHANNEL("channel", "渠道"),
    DEPART_PROPERTY_COMPANY("company", "公司"),
    DEPART_PROPERTY_DEPARTMENT("department", "部门"),
    DEPART_PROPERTY_OFFICE("office", "管理处"),
    DEPART_PROPERTY_PROJECT("project", "项目"),
    DEPART_PROPERTY_FLOOR("floor", "楼栋"),
    ;

    private String code;
    private String desc;

    DepartPropertyEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(String value) {
        if (value == null) return "";
        DepartPropertyEnum[] enums = values();
        for (DepartPropertyEnum typeEnum : enums) {
            if (value.equals(typeEnum.getCode())) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static String getValue(String desc) {
        DepartPropertyEnum[] enums = values();
        for (DepartPropertyEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }

}
